#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time     :2020/08/04
# @Author   :Changshu
# @File     :practice_27.py
# 27. 移除元素

def removeElement(nums:list,val:int)->int:
	j=len(nums)
	for i in range(j-1,-1,-1):
		if nums[i]==val:
			nums.pop(i)
	return len(nums)

if __name__=='__main__':
	nums=[0,1,2,2,3,0,4,2]
	val=2
	print(removeElement(nums,val))